﻿package cyper.swtexamples;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class AutoCompleteComboMain {
    static final Display display = new Display();
    static final Shell shell = new Shell(display);
    static String[] items = new String[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };

    public static void main(String[] args) {
        shell.setText("SWT");
        shell.setLayout(new GridLayout());

        Combo combo = new Combo(shell, SWT.BORDER);
        for (int i = 0; i < items.length; i++) {
            combo.add(items[i]);
        }
        ComboUtil.addAutoCompleteFeature(combo);
      
        shell.pack();
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }
}
